package com.droowa.util;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.MailException;
import org.springframework.mail.MailSender;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.stereotype.Component;

import com.droowa.domain.Customer;

@Component
public class SimpleRegistrationNotifier implements RegistrationNotifier{
	
	@Autowired
	private MailSender mailSender;
	
	@Override
	public void sendEmail(Customer customer) throws MailException, NullPointerException{
		SimpleMailMessage message=new SimpleMailMessage();
		message.setSubject(" DROOWA.com ");
		message.setText("회원님의 비밀번호는 : "+customer.getPassword()+"입니다.");
		message.setFrom("zzzcxcx@gmail.com");
		message.setTo(customer.getEmail());
		
		mailSender.send(message);
	}
	
}
